-module(p15).
-compile(export_all).


main(N) ->
    Pas = pascal(2 * N),
    lists:max(Pas).

pascal(1) -> [1, 1];
pascal(N) -> pascal_line(pascal(N - 1)).

pascal_line([1]) -> [1];
pascal_line([1 | [H | _Tail]=Z]) -> [1, H + 1 | pascal_line(Z)];
pascal_line([H1 | [H2 | _Tail]=Z]) -> [H1 + H2 | pascal_line(Z)].

